﻿@using ZR.CodeGenerator
@using ZR.Model.System.Generate
@*@model ZR.CodeGenerator.Model.GenerateDto;*@
@{
    var genTable = Model.GenTable;
    var subTableOptions = Model.SubTableOptions;
    var options = Model.GenOptions;
    var replaceDto = Model.ReplaceDto;
}
@foreach(var column in genTable.Columns)
{
    var labelName = "";
    var checkboxHtml = "";
    var showToolTipHtml = "";
    var columnName = column.CsharpFieldFl;
    if(column.CsharpType == "string" || column.HtmlType == "datetime")
    {
        showToolTipHtml = " :show-overflow-tooltip=\"true\"";
    }
    if (column.FieldDesc != "")
    {
        labelName = column.FieldDesc;
    }
    else
    {
        labelName = column.CsharpFieldFl;
    }
    if(column.IsList == true)
    {
        if (column.HtmlType == "customInput" && column.IsPk == false)
        {
            <el-table-column prop="@(columnName)" label="@(labelName)" width="90" sortable align="center">
                <template slot-scope="scope">
                    <span v-show="editIndex != scope.$index" @@click="editCurrRow(scope.$index,'rowkeY')">{{scope.row.@(columnName)}}</span>
                    <el-input :id="scope.$index+'rowkeY'" size="mini" v-show="(editIndex == scope.$index)"
                    v-model="scope.row.@(columnName)" @@blur="handleChangeSort(scope.row)"></el-input>
                </template>
            </el-table-column>
        }
        else if (column.HtmlType == "imageUpload")
        {
            <el-table-column prop="@(columnName)" label="@(labelName)" align="center">
                <template slot-scope="scope">
                    <el-image class="table-td-thumb" fit="contain" :src="scope.row.@(columnName)" :preview-src-list="[scope.row.@(columnName)]">
                        <div slot="error"><i class="el-icon-document" /></div>
                    </el-image>
                </template>
            </el-table-column>
        }
        else if (column.HtmlType == "checkbox" || column.HtmlType == "select" || column.HtmlType == "radio")
        {
            <el-table-column prop="@(columnName)" label="@(labelName)" align="center">
                <template slot-scope="scope">
                    @if (column.HtmlType == "checkbox")
                    {
                        <dict-tag :options="@(column.DictType != ""?column.DictType:$"{column.CsharpFieldFl}Options")" :value="scope.row.@(columnName) ? scope.row.@(columnName).split(',') : []" />
                    }
                    else
                    {
                        <dict-tag :options="@(column.DictType != ""?column.DictType:$"{column.CsharpFieldFl}Options")" :value="scope.row.@(columnName)" />
                    }
                </template>
            </el-table-column>
        }
        else
        {
            <el-table-column prop="@(columnName)" label="@(labelName)" align="center"@(showToolTipHtml) />
        }
    }
}
